<?php

namespace App\Remote\Feishu\Message\Tools;


use App\Remote\Feishu\Message\Tools\MsgTagBuild\TagMsgBuild;

class TextMsgBuildTools extends MsgBuildBaseTools
{


    /**
     * @param TagMsgBuild ...$tagMsgBuild
     * @return $this
     */
    public function setRowContent(TagMsgBuild ...$tagMsgBuild): TextMsgBuildTools
    {
        array_push(
            $this->content,
            collect($tagMsgBuild)->map(function (TagMsgBuild $msgBuild) {
                return $msgBuild->toArray();
            })->values()->toArray());
        return $this;
    }

    /**
     * @return array
     */
    public function toArray(): array
    {
        // TODO: Implement toArray() method.
        return [
            "post" => [
                "zh_cn" => [
                    "title"   => $this->title,
                    "content" => $this->content
                ]
            ]
        ];
    }
}
